
chcp 65001

:: cd %~dp0

echo %~dp0;
pushd %~dp0

rmdir /s /q build

:: Set up the Visual Studio environment for command-line use
if exist "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat" (
	call  "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Professional\Build\vcvars64.bat" (
	call  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Professional\Build\vcvars64.bat"
) else if exist "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat" (
	call  "C:\Program Files\Microsoft Visual Studio\2022\Community\VC\Auxiliary\Build\vcvars64.bat"
) else (
	echo Can't find Visual Studio 2022 VC++. Please install VS2022 with VC++
	pause
	exit
)

REM Debug
REM Release
REM RelWithDebInfo
REM MinSizeRel

set config=RelWithDebInfo

cmake -S . -B build2 -G "Ninja Multi-Config"

:: Build the project with Ninja
cmake --build build2 --config=%config%

echo ------------------
echo Multi-Config build finish
echo -----------------

.\build2\%config%\main.exe

popd
pause